import math

class PointOfView:
    def __init__(self, x=0, y=0, angle=0):
        self.x = x
        self.y = y
        self.angle = angle

        
class Player(PointOfView):

    def __init__(self, x=0, y=0, angle=0, turn_speed=60, move_speed=192):
        PointOfView.__init__(self, x, y, angle)
        self.angle_speed = turn_speed
        self.move_speed = move_speed
    
         
    def move_to(self, angle, mult_factor):
        ''' Moves the player. '''      
        self.x += self.move_speed * math.cos(math.radians(angle)) * mult_factor
        self.y -= self.move_speed * math.sin(math.radians(angle)) * mult_factor
        

    def move_forward(self, mult_factor):
        ''' Moves the player forward. '''
        self.move_to(self.angle, mult_factor)
        
        
    def move_backward(self, mult_factor):
        ''' Moves the player backward. '''
        self.move_to(self.angle + 180, mult_factor)
        

    def turn_left(self, mult_factor):
        ''' Turns the angle of view to the left. '''
        self.angle += self.angle_speed * mult_factor
        

    def turn_right(self, mult_factor):
        ''' Turns the angle of view to the right. '''
        self.angle -= self.angle_speed * mult_factor
        

    def strafe_left(self, mult_factor):
        ''' Strafes the player to the left. '''
        self.move_to(self.angle + 90, mult_factor)
        

    def strafe_right(self, mult_factor):
        ''' Strafes the player to the right. '''
        self.move_to(self.angle - 90, mult_factor)
